const app = getApp()
const mineService = require('../../service/mine.js');

Component({
  /**
   * 组件的属性列表
   */
  properties: {
    item:{
      type:Object,
      value:{}
    }
  },

  /**
   * 组件的初始数据
   */
  data: {
    followname: '关注作者',
    followbindtap:'fansFollow'
  },

  /**
   * 组件的方法列表
   */
  methods: {
   fansFollow(){
    if (!app.checkLogin()) return false;
    let d = {
      follower: this.data.item.unionId,
      objectType:0,
      unionId:app.globalData.userinfo.unionId
    };
    console.log(d);
    mineService.fansFollow(d).then(res => {
      if(res.resCode == 0){
        wx.showToast({
          title: '关注成功',
          icon:"none"
        })
        this.setData({
         followname: '已关注',
         followbindtap:''
        });
      }
    })   
   }
  }
})
